﻿// -----------------------------------------------------------------------
// <copyright file="SyncRunner.cs" company="Microsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace RRSync.Console
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
using RRSync.Lib;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class SyncRunner
    {
        private IFileStatesManager _fileStateManager;

        public SyncRunner()
        {
            this._fileStateManager = FileStatesManager.Instance;
            this._fileStateManager.StateChanged += new StateChangesEventHandler(FileStateManager_StateChanged);
        }

        public IFileStatesManager FileStateManager
        {
            get { return this._fileStateManager; }
        }

        private void FileStateManager_StateChanged(object sender, StateChangesEventArgs stateChanges)
        {
            switch (stateChanges.ChangeType)
            {
                case ChangeTypes.Create:
                    Console.WriteLine(">>Create new file '{0}' [{1}, {2}]", stateChanges.FileName, stateChanges.FileState.Hash, stateChanges.FileState.LastModified);
                    break;
                case ChangeTypes.Update:
                    Console.WriteLine(">>Update file '{0}' [{1}, {2}]", stateChanges.FileName, stateChanges.FileState.Hash, stateChanges.FileState.LastModified);
                    break;
                case ChangeTypes.Delete:
                    Console.WriteLine(">>Delete file '{0}' [{1}, {2}]", stateChanges.FileName, stateChanges.FileState.Hash, stateChanges.FileState.LastModified);
                    break;
                default:
                    break;
            }
        }
    }
}
